home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
ELECTRIC
/
DSPICE0S.ZIP
/
acdcmp.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-11-22
|
9KB
|
260 lines
/* acdcmp.f -- translated by f2c (version of 3 February 1990 3:36:42).
You must link the resulting object file with the libraries:
-lF77 -lI77 -lm -lc (in that order)
*/
#include "f2c.h"
/* Common Block Declarations */
struct {
integer ielmnt, isbckt, nsbckt, iunsat, nunsat, itemps, numtem, isens,
nsens, ifour, nfour, ifield, icode, idelim, icolum, insize,
junode, lsbkpt, numbkp, iorder, jmnode, iur, iuc, ilc, ilr,
numoff, isr, nmoffc, iseq, iseq1, neqn, nodevs, ndiag, iswap,
iequa, macins, lvnim1, lx0, lvn, lynl, lyu, lyl, lx1, lx2, lx3,
lx4, lx5, lx6, lx7, ld0, ld1, ltd, imynl, imvn, lcvn, nsnod,
nsmat, nsval, icnod, icmat, icval, loutpt, lpol, lzer, irswpf,
irswpr, icswpf, icswpr, irpt, jcpt, irowno, jcolno, nttbr, nttar,
lvntmp;
} tabinf_;
#define tabinf_1 tabinf_
struct {
integer locate[50], jelcnt[50], nunods, ncnods, numnod, nstop, nut, nlt,
nxtrm, ndist, ntlin, ibr, numvs, numalt, numcyc;
} cirdat_;
#define cirdat_1 cirdat_
struct {
integer iprnta, iprntl, iprntm, iprntn, iprnto, limtim, limpts, lvlcod,
lvltim, itl1, itl2, itl3, itl4, itl5, itl6, igoof, nogo, keof;
} flags_;
#define flags_1 flags_
struct {
doublereal twopi, xlog2, xlog10, root2, rad, boltz, charge, ctok, gmin,
reltol, abstol, vntol, trtol, chgtol, eps0, epssil, epsox, pivtol,
pivrel;
} knstnt_;
#define knstnt_1 knstnt_
struct {
doublereal value[200000];
} blank_;
#define blank_1 blank_
struct {
doublereal omega, time, delta, delold[7], ag[7], vt, xni, egfet, xmu,
sfactr;
integer mode, modedc, icalc, initf, method, iord, maxord, noncon, iterno,
itemno, nosolv, modac, ipiv, ivmflg, ipostp, iscrch, iofile;
} status_;
#define status_1 status_
/* Table of constant values */
static integer c__1 = 1;
/*< subroutine acdcmp >*/
/* Subroutine */ int acdcmp_()
{
/* Format strings */
static char fmt_11[] = "(\0020\002,\002 underflow occured at step n= \
\002,i5)";
/* System generated locals */
doublereal d_1, d_2;
/* Builtin functions */
integer s_wsfe(), do_fio(), e_wsfe();
/* Local variables */
static integer locc;
extern /* Subroutine */ int cdiv_();
static integer locr, nxti, nxtj, i, j;
static doublereal gdiag;
static integer n, locij;
static doublereal ximag;
static integer locnn;
static doublereal xreal;
static integer n1, n2;
extern integer indxx_();
extern /* Subroutine */ int cmult_();
#define nodplc ((integer *)&blank_1)
#define cvalue ((complex *)&blank_1)
/* Fortran I/O blocks */
static cilist io__10 = { 0, 0, 0, fmt_11, 0 };
/*< implicit double precision (a-h,o-z) >*/
/* this routine performs an lu factorization of the circuit equation
*/
/* coefficient matrix. */
/* spice version 2g.6 sccsid=tabinf 3/15/83 */
/*< common /tabinf/ ielmnt,isbckt,nsbckt,iunsat,nunsat,itemps,numtem, >*/
/*< 1 isens,nsens,ifour,nfour,ifield,icode,idelim,icolum,insize, >*/
/*< 2 junode,lsbkpt,numbkp,iorder,jmnode,iur,iuc,ilc,ilr,numoff,isr, >*/
/*< 3 nmoffc,iseq,iseq1,neqn,nodevs,ndiag,iswap,iequa,macins,lvnim1, >*/
/*< 4 lx0,lvn,lynl,lyu,lyl,lx1,lx2,lx3,lx4,lx5,lx6,lx7,ld0,ld1,ltd, >*/
/*< 5 imynl,imvn,lcvn,nsnod,nsmat,nsval,icnod,icmat,icval, >*/
/*< 6 loutpt,lpol,lzer,irswpf,irswpr,icswpf,icswpr,irpt,jcpt, >*/
/*< 7 irowno,jcolno,nttbr,nttar,lvntmp >*/
/* spice version 2g.6 sccsid=cirdat 3/15/83 */
/*< common /cirdat/ locate(50),jelcnt(50),nunods,ncnods,numnod,nstop, >*/
/*< 1 nut,nlt,nxtrm,ndist,ntlin,ibr,numvs,numalt,numcyc >*/
/* spice version 2g.6 sccsid=flags 3/15/83 */
/*< common /flags/ iprnta,iprntl,iprntm,iprntn,iprnto,limtim,limpts, >*/
/*< 1 lvlcod,lvltim,itl1,itl2,itl3,itl4,itl5,itl6,igoof,nogo,keof >*/
/* spice version 2g.6 sccsid=knstnt 3/15/83 */
/*< common /knstnt/ twopi,xlog2,xlog10,root2,rad,boltz,charge,ctok, >*/
/*< 1 gmin,reltol,abstol,vntol,trtol,chgtol,eps0,epssil,epsox, >*/
/*< 2 pivtol,pivrel >*/
/* spice version 2g.6 sccsid=blank 3/15/83 */
/*< common /blank/ value(200000) >*/
/* spice version 2g.6 sccsid=status 3/15/83 */
/*< common /status/ omega,time,delta,delold(7),ag(7),vt,xni,egfet, >*/
/*< 1 xmu,sfactr,mode,modedc,icalc,initf,method,iord,maxord,noncon, >*/
/*< 2 iterno,itemno,nosolv,modac,ipiv,ivmflg,ipostp,iscrch,iofile >*/
/*< integer nodplc(64) >*/
/*< complex cvalue(32) >*/
/*< equivalence (value(1),nodplc(1),cvalue(1)) >*/
/*< n=1 >*/
n = 1;
/*< 10 n=n+1 >*/
L10:
++n;
/*< nxti=n >*/
nxti = n;
/*< nxtj=n >*/
nxtj = n;
/* calculate contribution from (nxti,nxtj) */
/*< if (n.ge.nstop) return >*/
if (n >= cirdat_1.nstop) {
return 0;
}
/*< n1=nodplc(irswpf+nxti) >*/
n1 = nodplc[tabinf_1.irswpf + nxti - 1];
/*< n2=nodplc(icswpf+nxtj) >*/
n2 = nodplc[tabinf_1.icswpf + nxtj - 1];
/*< locnn=indxx(n1,n2) >*/
locnn = indxx_(&n1, &n2);
/*< gdiag=dabs(value(lynl+locnn))+dabs(value(imynl+locnn)) >*/
gdiag = (d_1 = blank_1.value[tabinf_1.lynl + locnn - 1], abs(d_1)) + (d_2
= blank_1.value[tabinf_1.imynl + locnn - 1], abs(d_2));
/*< if (gdiag.ge.pivtol) go to 20 >*/
if (gdiag >= knstnt_1.pivtol) {
goto L20;
}
/*< value(lynl+locnn)=pivtol >*/
blank_1.value[tabinf_1.lynl + locnn - 1] = knstnt_1.pivtol;
/*< value(imynl+locnn)=0.0d0 >*/
blank_1.value[tabinf_1.imynl + locnn - 1] = 0.;
/*< write(iofile,11) n >*/
io__10.ciunit = status_1.iofile;
s_wsfe(&io__10);
do_fio(&c__1, (char *)&n, (ftnlen)sizeof(integer));
e_wsfe();
/*< 11 format(1h0,' underflow occured at step n= ',i5) >*/
/* down col j */
/*< 20 locr=nodplc(irpt+locnn) >*/
L20:
locr = nodplc[tabinf_1.irpt + locnn - 1];
/*< 25 if (locr.eq.0) go to 10 >*/
L25:
if (locr == 0) {
goto L10;
}
/*< i=nodplc(irowno+locr) >*/
i = nodplc[tabinf_1.irowno + locr - 1];
/*< call cdiv(value(lynl+locr),value(imynl+locr),value(lynl+locnn), >*/
/*< 1 value(imynl+locnn),value(lynl+locr),value(imynl+locr)) >*/
cdiv_(&blank_1.value[tabinf_1.lynl + locr - 1], &blank_1.value[
tabinf_1.imynl + locr - 1], &blank_1.value[tabinf_1.lynl + locnn
- 1], &blank_1.value[tabinf_1.imynl + locnn - 1], &blank_1.value[
tabinf_1.lynl + locr - 1], &blank_1.value[tabinf_1.imynl + locr -
1]);
/*< locc=nodplc(jcpt+locnn) >*/
locc = nodplc[tabinf_1.jcpt + locnn - 1];
/* for each element look up row nxti */
/*< 30 if (locc.eq.0) go to 70 >*/
L30:
if (locc == 0) {
goto L70;
}
/*< j=nodplc(jcolno+locc) >*/
j = nodplc[tabinf_1.jcolno + locc - 1];
/* locate element (i,j) */
/*< 35 if (j.lt.i) go to 45 >*/
/* L35: */
if (j < i) {
goto L45;
}
/*< locij=locc >*/
locij = locc;
/*< 40 locij=nodplc(irpt+locij) >*/
L40:
locij = nodplc[tabinf_1.irpt + locij - 1];
/*< if (nodplc(irowno+locij).eq.i) go to 55 >*/
if (nodplc[tabinf_1.irowno + locij - 1] == i) {
goto L55;
}
/*< go to 40 >*/
goto L40;
/*< 45 locij=locr >*/
L45:
locij = locr;
/*< 50 locij=nodplc(jcpt+locij) >*/
L50:
locij = nodplc[tabinf_1.jcpt + locij - 1];
/*< if (nodplc(jcolno+locij).eq.j) go to 55 >*/
if (nodplc[tabinf_1.jcolno + locij - 1] == j) {
goto L55;
}
/*< go to 50 >*/
goto L50;
/*< 55 call cmult(value(lynl+locc),value(imynl+locc), >*/
/*< 1 value(lynl+locr),value(imynl+locr),xreal,ximag) >*/
L55:
cmult_(&blank_1.value[tabinf_1.lynl + locc - 1], &blank_1.value[
tabinf_1.imynl + locc - 1], &blank_1.value[tabinf_1.lynl + locr -
1], &blank_1.value[tabinf_1.imynl + locr - 1], &xreal, &ximag);
/*< value(lynl+locij)=value(lynl+locij)-xreal >*/
blank_1.value[tabinf_1.lynl + locij - 1] -= xreal;
/*< value(imynl+locij)=value(imynl+locij)-ximag >*/
blank_1.value[tabinf_1.imynl + locij - 1] -= ximag;
/*< locc=nodplc(jcpt+locc) >*/
locc = nodplc[tabinf_1.jcpt + locc - 1];
/*< go to 30 >*/
goto L30;
/*< 70 locr=nodplc(irpt+locr) >*/
L70:
locr = nodplc[tabinf_1.irpt + locr - 1];
/*< go to 25 >*/
goto L25;
/*< end >*/
} /* acdcmp_ */
#undef cvalue
#undef nodplc